package com.java.simple.study.jvm.sugar;

import com.java.simple.study.jvm.memstruct.methodarea.Demo3_6;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author zhoujunlin
 * @date 2022/1/16
 * @desc 语法糖try-with-resource
 **/
public class Demo8_7 {


    public static void main(String[] args) throws Exception {
        try (MyResource myResource = new MyResource()) {
            int i = 1 / 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void test() throws IOException {
        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
                Demo3_6.class.getClassLoader().getResourceAsStream("剑来.txt")))) {
            System.out.println("11111111");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
